#include "defines.h"
#include "kozos.h"
#include "lib.h"
#include "interrupt.h"

int consdrv_main(int argc, char *argv[]);
int command_main(int argc, char *argv[]);
int testdma(int argc, char *argv[]);

static int start_threads(int argc, char *argv[])
{
    kz_run(consdrv_main, "consdrv", 2, 0x200, 0, NULL);
    kz_run(command_main, "command", 8, 0x200, 0, NULL);
    kz_run(testdma, "testdma", 1, 0x100, 0, NULL);

    kz_chpri(15);
    INTR_ENABLE;
    while (1) {
        asm volatile ("sleep");
    }

    return 0;
}

int main(void)
{
    INTR_DISABLE;

    puts("KOZOS booted successfully.\n");
    
    ky_start(start_threads, "idle", 0, 0x100, 0, NULL);
        
    return 0;
}
